/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Objects;

import Engine.Engine;
import Engine.QuadTree;

/**
 * Tiro.
 * @author Gustavo Buzogany Eboli
 */
public class Projectile extends MovableObject {

    public Projectile(int id, Engine engine)
    {
        super(id, engine);
        this.showHealthBar = false;
    }

    @Override
    public void update(QuadTree qt) {
        speed = speed.addScaled(0.01f, accel);
        qt.ObjectMoved(this, pos);

        ang_speed = ang_speed.addScaled(0.01f, ang_accel);
        if (ang_speed.x() > 5.0f) {
            ang_speed.setX(5.0f);
        } else if (ang_speed.x() < -5.0f) {
            ang_speed.setX(-5.0f);
        }


        euler_ang.add(ang_speed);
        if (this.euler_ang.x() > 360) {
            this.euler_ang.setX(this.euler_ang.x() - 360);
        }
        if (this.euler_ang.x() < -360) {
            this.euler_ang.setX(this.euler_ang.x() + 360);
        }
        pos.add(speed);
    }
}
